﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Easyui扩展库 Panel - 落阳 整理</title>
    <link href="http://www.easyui-extlib.com/Content/Site.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery/jquery-1.11.0.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-extensions/jquery.jdirk.js"></script>
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <script>
        $(function () {

            var checkExtJs = function () {
                var topHead = $("head"),
                    existHeadContent = topHead.html(),
                    exist = $.string.contains(existHeadContent, "jeasyui.extensions.panel.setTitle.js");
                console.log(existHeadContent);
                return exist;
            };

            var checkExtJsAndAlert = function () {
                if (!checkExtJs()) { alert("尚未在window中添加对 setTitle 扩展的引用，请点击添加引用的按钮。"); return false; }
                return true;
            };

            $("#btnAppendExtJs").click(function () {
                if (checkExtJs()) {
                    alert("已经添加 setTitle 扩展的引用，无需重复添加。");
                } else {
                    var jsUrl = ["http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/base/jeasyui.extensions.base.isEasyUI.js", "http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/panel/jeasyui.extensions.panel.setTitle.js"];
                    $.util.loadJs(jsUrl);
                    alert("setTitle 扩展的引用添加成功。");
                    $("#msg").html("setTitle 扩展的引用添加成功。再去点击 设置title 的按钮试试。");
                }
            });


            $("#btnSet1").click(function () {
                var p = $("#pTab1");
                p.panel("setTitle", "巨魔1号");
            });



        });
    </script>
    <div class="easyui-tabs" data-options="fit:true,border:false">
        <div id="pTab1" data-options="title:'标签页1号面板'" style="padding:10px;">
            标签页1号面板的内容
            <br /><br /><br />
            <span style="color:red;font-weight:bold;">本页面，初始化时不加载扩展js（jeasyui.extensions.panel.setTitle.js），此时点击以下按钮，“设置标题”操作是不成功的。</span>
            <br /><br /><br />
            <a id="btnSet1" class="easyui-linkbutton" data-options="iconCls:'icon-add'">设置1号面板的 title 为“巨魔1号”</a>
            <br /><br /><br />
            <br /><br /><br />
            <a id="btnAppendExtJs" class="easyui-linkbutton" data-options="iconCls:'icon-add'">向本页面中载入扩展js（jeasyui.extensions.panel.setTitle.js）</a>
            <br /><br /><br />
            <span style="color:red;" id="msg"></span>
        </div>
        <div data-options="title:'标签页2号面板'" style="padding:10px;">
            标签页2号面板的内容
        </div>
    </div>
</body>
</html>
